package demo.demo5;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class TrainStationInvocationHandler implements InvocationHandler {
    //声明目标对象
    private TrainStation station;

    public TrainStationInvocationHandler(TrainStation station) {
        this.station = station;
    }
        public Object invoke (Object proxy, Method method, Object[]args) throws Throwable {
            //执行目标对象的方法
            Object obj = method.invoke(station, args);
            System.out.println("加收5元");
            return obj;
        }
    }